<?php  
class Controllercommonnews extends Controller {
	public function index() {
		$this->document->setTitle($this->config->get('config_title'));
		$this->document->setDescription($this->config->get('config_meta_description'));
        $this->document->setCurrentLocation('资讯·服务');
        
		$this->data['heading_title'] = $this->config->get('config_title');
		
		if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/common/news.tpl')) {
			$this->template = $this->config->get('config_template') . '/template/common/news.tpl';
		} else {
			$this->template = 'default/template/common/news.tpl';
		}
		
        
        $this->load->model('catalog/new');
		
		$this->data['news'] = array();

		foreach ($this->model_catalog_new->getNews() as $result) {
      		$this->data['news'][] = array(
        		'title' => $result['title'],
	    		'href'  => $this->url->link('new/new', 'new_id=' . $result['new_id']),
                'date' => $result['datetime'],
                'type' => $result['type']
      		);
    	}
        
		$this->children = array(
			'common/footer',
			'common/header'
		);
        

				
		$this->response->setOutput($this->render());										
        
        
	}
}
?>